function PP=Setup_PP(ParamInput)

%% Structural Parameters
%--------------------------------------------------------------------------
% Heterogeneous Household Block
%--------------------------------------------------------------------------
% Preference
% BETA        =   1-0.051/4;
NU_C        =   1;
NU_L        =   1;

% Life-cycle
XI          =   1/45/4;

% Transition Probability
Prob_ext    =   0.16;
TrProb_ext  =   0.90;
WGap_ext    =   0.00;

Prob_H      =   0.35;
TrProb_H    =   0.90;
WGap_H      =   0.00;

% Liquid Asset Borrowing Premium
KAPPA       =   0.06/4;

% Financial Constraint
b_lb        =   -1;

% Income Tax Rate and Transfer
TAU_SS      =   0.20;
UI_Slack    =   0;
MinCon      =   1e-2;

% Portfolio Choice Parameters
Fin_DomShare=   0.7;
Fin_AdjCost =   0.1;
%--------------------------------------------------------------------------
% New Keynesian Block
%--------------------------------------------------------------------------
% Steady State Levels
i_dom_SS    =   0.04/4;
i_ext_SS    =   0.04/4;
Pir_SS      =   0.02/4;
N_SS        =   0.33;
T_SS        =   0.12;
B_Y_SS      =   3.12;
B_Total_SS  =   0.91*4;
% Consumption Basket
Cons_FracT  =   0.5;
Cons_ElasTN =   0.8;
Cons_FracH  =   0.6;
Cons_ElasHF =   0.8;
% Technology
ALPHA_N     =   0.00;
ALPHA_H     =   0.00;
% Price Setting
EPSILON_N   =   10;
EPSILON_H   =   10;
THETA_N     =   100;
THETA_H     =   100;
% Monetary Policy
Taylor_ir   =   0.75;
Taylor_Pi   =   1.1;
Taylor_Pi_N =   0;
Taylor_Pi_H =   0;
Taylor_dE   =   0;
% Aggregation Shocks: Persistence
RHO_Z       =   0.7;
RHO_Z_H     =   0.7;
RHO_Z_N     =   0.7;
RHO_M_dom   =   0.7;
RHO_M_ext   =   0.7;
RHO_Y_H     =   0.7;
RHO_p_F     =   0.95;
% Aggregation Shocks: Std
SIG_Z       =   0.01/4; 
SIG_Z_H     =   0.01/4; 
SIG_Z_N     =   0.01/4;
SIG_M_dom   =   0.01/4;
SIG_M_ext   =   0.01/4;
SIG_Y_H     =   0.01/4;
SIG_p_F     =   0.05/5;

Flag_dE     =   1;
Flag_Price  =   1;
%--------------------------------------------------------------------------
% Update the Parameter Values based on the Input Information
%--------------------------------------------------------------------------
if nargin>0
    ParamList   =   fieldnames(ParamInput);
    for ii=1:length(ParamList)
        eval([ParamList{ii},'=ParamInput.',ParamList{ii},';']);
    end
end

%% Derived Parameters Directly Used in Computation
TrProb_dom  =   1-Prob_ext*(1-TrProb_ext)/(1-Prob_ext);
TrProb_N    =   1-Prob_H*(1-TrProb_H)/(1-Prob_H);

WGap_FI     =   [-Prob_ext*WGap_ext/(1-Prob_ext);WGap_ext];
WGap_RI     =   [-Prob_H*WGap_H/(1-Prob_H);WGap_H];
%% Computation Parameters
%--------------------------------------------------------------------------
% Grid of Exogenous States 
%--------------------------------------------------------------------------
%==
% Idiosyncratic Income State
%==
% Step 1: Mixed Markov Chains
Rho_1           =   0.7494;
Sig_1           =   0.7757;
Skew_1          =   -4.0703;
Rho_2           =   0.2518;
Sig_2           =   0.3149;
Skew_2          =   2.0482;

[Grid_1,TrMat_1]=   Rouwenhorst(3,Rho_1,0,Sig_1,Skew_1);
[Grid_2,TrMat_2]=   Rouwenhorst(3,Rho_2,0,Sig_2,Skew_2);
[TempGrid,TrMat]=   MarkovChain_IndependentMixture({Grid_1,TrMat_1},{Grid_2,TrMat_2});            
State_IdioInc   =   sum(TempGrid,2);
ShrinkFactor    =   1;
State_IdioInc   =   State_IdioInc/ShrinkFactor;

% Step 2: Sort the Idio-Income Shock Grid
[State_IdioInc,TempInd] ...
                =   sort(State_IdioInc);
TrMat_IdioInc   =   TrMat(TempInd,:);
TrMat_IdioInc   =   TrMat_IdioInc(:,TempInd);
Node_IdioInc    =   exp(State_IdioInc);
TrMat_IdioInc(TrMat_IdioInc<1e-6) ...
                =   0;
TrMat_IdioInc   =   bsxfun(@rdivide,TrMat_IdioInc,sum(TrMat_IdioInc));
if nnz(TrMat_IdioInc)/numel(TrMat_IdioInc)>0.2
    TrMat_IdioInc   =   sparse(TrMat_IdioInc);
end

% Step 3: Normalization
InvDist_IdioInc =   MarkovChain_InvDist(TrMat_IdioInc,[]);
Node_IdioInc    =   Node_IdioInc/(Node_IdioInc'*InvDist_IdioInc);
Num_IdioInc     =   size(Node_IdioInc,1);


IdioInc         =   struct('N',Num_IdioInc,'State',State_IdioInc,...
                           'Node',Node_IdioInc,'IndNode',(1:1:Num_IdioInc)',...
                           'TrMat',TrMat_IdioInc,'InvDist',InvDist_IdioInc);

%==
% Heterogeneity in Financial Integration
%==
Node_FI         =   [0;1];
TrMat_FI        =   [TrProb_dom,1-TrProb_ext;...
                     1-TrProb_dom,TrProb_ext];
InvDist_FI      =   MarkovChain_InvDist(TrMat_FI,[]);
Num_FI          =   size(Node_FI,1);
Idio_FI         =   struct('N',Num_FI,'State',Node_FI,...
                           'Node',Node_FI,'IndNode',(1:1:Num_FI)',...
                           'TrMat',TrMat_FI,'InvDist',InvDist_FI);
%==
% Heterogeneity in Real Integration
%==
Node_RI         =   [0;1];
TrMat_RI        =   [TrProb_N,1-TrProb_H;...
                     1-TrProb_N,TrProb_H];
InvDist_RI      =   MarkovChain_InvDist(TrMat_RI,[]);
Num_RI          =   size(Node_RI,1);
Idio_RI         =   struct('N',Num_RI,'State',Node_RI,...
                           'Node',Node_RI,'IndNode',(1:1:Num_RI)',...
                           'TrMat',TrMat_RI,'InvDist',InvDist_RI);
% Collect the Grids for Exogenous State
ExoState        =   struct('IdioInc',IdioInc,'Idio_FI',Idio_FI,'Idio_RI',Idio_RI);

%--------------------------------------------------------------------------
% Quadrature for Integration
%--------------------------------------------------------------------------
% Shocks to xxxxx

% Collect the Quadrature for Integration over Shocks
QW          =   struct();

%--------------------------------------------------------------------------
% Function Approximation
%--------------------------------------------------------------------------
Nb  =   30; Cb  =   0.3;
% VFun
VFunApp     =   struct('f',struct('N',Nb, ...
                                  'BreakCurvature',Cb, ...
                                  'PolyOrder',2,...
                                  'AppType','spli') ...
                       );

% Collect the Function Approximation Structure
FunAppStruct=   struct('V',VFunApp);

%--------------------------------------------------------------------------
% Policy Approximation
%--------------------------------------------------------------------------
VPolApp     =   struct('f',struct('N',40,...
                                  'BreakCurvature',0.1, ...
                                  'PolyOrder',2,...
                                  'AppType','spli') ...
                       );
                   
% Collect the Policy Approximation Structure
PolAppStruct=   struct('V',VPolApp);

%--------------------------------------------------------------------------
% Distribution Approximation
%--------------------------------------------------------------------------
f_N         =   50;
f_Curve     =   log(1e2)/f_N;
DistAppStruct ...
            =   struct('f',struct('N',f_N,'BreakCurvature',f_Curve) ...
                       );
%--------------------------------------------------------------------------
% General Computation
%--------------------------------------------------------------------------
DampenCoef  =   1-0.0;
InfoPrint   =   2;
ItTol       =   1e-6;
%% Collect the Parameters
PP          =   struct(... % Structural Parameters
                       ...%'BETA',BETA,...
                       'NU_C',NU_C,'NU_L',NU_L,'N_SS',N_SS,...
                       'XI',XI,...
                       'Fin_DomShare',Fin_DomShare,'Fin_AdjCost',Fin_AdjCost,...
                       'WGap_RI',WGap_RI,'WGap_FI',WGap_FI,...
                       'KAPPA',KAPPA,'b_lb',b_lb,...
                       'TAU_SS',TAU_SS,'T_SS',T_SS,...
                       'B_Total_SS',B_Total_SS,'B_Y_SS',B_Y_SS,...
                       'UI_Slack',UI_Slack,'MinCon',MinCon,...
                       'i_dom_SS',i_dom_SS,'i_ext_SS',i_ext_SS,...
                       'Pir_SS',Pir_SS,...
                       'Cons_FracT',Cons_FracT,'Cons_ElasTN',Cons_ElasTN,...
                       'Cons_FracH',Cons_FracH,'Cons_ElasHF',Cons_ElasHF,...
                       'ALPHA_H',ALPHA_H,'ALPHA_N',ALPHA_N,...
                       'EPSILON_H',EPSILON_H,'EPSILON_N',EPSILON_N,...
                       'THETA_H',THETA_H,'THETA_N',THETA_N,...
                       'Taylor_Pi',Taylor_Pi,'Taylor_Pi_N',Taylor_Pi_N,'Taylor_Pi_H',Taylor_Pi_H,...
                       'Taylor_ir',Taylor_ir,'Taylor_dE',Taylor_dE,...
                       'RHO_Z',RHO_Z,'RHO_Z_H',RHO_Z_H,'RHO_Z_N',RHO_Z_N,...
                       'RHO_M_dom',RHO_M_dom,'RHO_M_ext',RHO_M_ext,'RHO_Y_H',RHO_Y_H,...
                       'RHO_p_F',RHO_p_F,...
                       'SIG_Z',SIG_Z,'SIG_Z_H',SIG_Z_H,'SIG_Z_N',SIG_Z_N,...
                       'SIG_M_dom',SIG_M_dom,'SIG_M_ext',SIG_M_ext,'SIG_Y_H',SIG_Y_H,...
                       'SIG_p_F',SIG_p_F,...
                       'Flag_dE',Flag_dE,'Flag_Price',Flag_Price,...
                       ... % Derived Parameters
                       ...'EffBETA',EffBETA,...
                       ... % Computation Parameters
                       'ExoState',ExoState,...
                       'QW',QW,...
                       'FunAppStruct',FunAppStruct,...
                       'PolAppStruct',PolAppStruct,...
                       'DistAppStruct',DistAppStruct,...
                       'DampenCoef',DampenCoef,...
                       'InfoPrint',InfoPrint,...
                       'ItTol',ItTol);